package com.cw.recommend.common.util

import com.cw.recommend.common.constant.SERVER_HOST
import redis.clients.jedis.Jedis

object RedisUtil {

  def getJedis: Jedis = {
    new Jedis(SERVER_HOST)
  }

  def jedisContext[T](f: Jedis=>T): T = {
    val j = getJedis
    val res = f(j)
    j.close()
    res
  }

}
